package util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

public class IOUtil {
	public static void appendMethodB(String path, String content) {
		  File writefile;
	        try {
	            // 通过这个对象来判断是否向文本文件中追加内容
	            // boolean addStr = append;

	            writefile = new File(path);
	            

	            // 如果文本文件不存在则创建它
	            if (writefile.exists() == false) {
	                writefile.createNewFile();
	                writefile = new File(path); // 重新实例化
	            }

	            FileOutputStream fos = new FileOutputStream(path, true);  
	            OutputStreamWriter osw = new OutputStreamWriter(fos, "gbk");  
	            osw.write(content);  
	            osw.close();  
	            fos.close();  
	        } catch (Exception ex) {
	            System.out.println(ex.getMessage());
	        }
    }
}
